import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 666
 * Date: 2022-10-30
 * Time: 11:13
 */
//public class test{
//    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
//        int a= scanner.nextInt();
//        q Q = new q();
//        Q.er(a);
//
//    }
//}
//class q{
//    public void er(int n){
//        int count=0;
//        int c=n;
//        while(n!=0){
//            n=n&(n-1);
//            count++;
//        }
//        System.out.println(c+"中的二进制数1的个数为"+count);
//    }
//}
public class test{
    public static void main(String[] args) {
        Scanner q=new Scanner(System.in);
        int a= q.nextInt();
        int b= q.nextInt();
        chu s = new chu();
        s.shixian(a,b);
    }
}
class chu{
    public void shixian(int x,int y){
        int c=0;
        while(y!=0){
            c=x%y;
            x=y;
            y=c;
        }
        System.out.println("最大公约数为"+x);
    }
}
